package com.hl.qzzpbackend.model.enums;

import cn.hutool.core.util.ObjUtil;
import lombok.Getter;

/**
 * 求职类型枚举
 * @author helong
 */
@Getter
public enum HuntingTypeEnum {

    FULL_TIME(0, "全职"),
    PART_TIME(1, "兼职"),
    PRACTICE(2, "实习");



    private final Integer value;
    private final String text;

    // 构造函数
    HuntingTypeEnum(Integer value, String text) {
        this.value = value;
        this.text = text;
    }


    /**
     * 根据value获取枚举
     * @param value 枚举值的value
     * @return 枚举值
     */
    public static HuntingTypeEnum getEnumByValue(Integer value) {
        if(ObjUtil.isEmpty(value)) {
            return null;
        }
        for (HuntingTypeEnum huntingTypeEnum : HuntingTypeEnum.values()) {
            if (huntingTypeEnum.getValue().equals(value)) {
                return huntingTypeEnum;
            }
        }
        return null;
    }
}
